package com.pxmeta.party.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pxmeta.party.entity.Gift;
import com.pxmeta.party.entity.LotteryLuckyUser;
import com.pxmeta.party.entity.Party;
import com.pxmeta.party.entity.dto.AddGiftDTO;
import com.pxmeta.party.entity.dto.CreatePartyDTO;
import com.pxmeta.party.entity.dto.UpdateGiftDTO;
import com.pxmeta.party.entity.dto.GiveLotteryGiftDTO;
import com.pxmeta.party.entity.dto.UpdateGiftDTO;
import com.pxmeta.party.entity.vo.GiftLotteryVO;
import com.pxmeta.party.entity.vo.LotteryGiftVO;
import com.pxmeta.party.entity.vo.TurntableLotteryVO;
import com.pxmeta.party.entity.vo.WormholeLotteryVO;

import java.util.List;

/**
 * <p>
 * 礼物表 服务类
 * </p>
 *
 * @author wcl
 * @since 2022-06-25
 */
public interface IGiftService extends IService<Gift> {

    IPage<Gift> getGiftList(Integer page, Integer size, Integer type);

    IPage<Gift> getGiftProbability(Integer page, Integer size, Integer type);


    List<Gift> getAllGiftList();

    void sendFullServerNotification(String text);

    void give(Long userId, Long targetUsername, Integer giftId, Long partyId, Integer type, Integer count);

    void give(Long userId, List<String> targetUsernames, Integer giftId, Long partyId, Integer type,Integer count);

    /**
     * 抽奖
     * @param giftId
     * @param targetUsernames
     * @return
     */
    List<LotteryGiftVO> lottery(Long userId,Integer giftId, List<String> targetUsernames,Long partyId);

    /**
     * 获取转盘礼物列表
     * @return
     */
    List<Gift> getTurntableGiftList(Integer type);

    /**
     * 抽奖
     * @param userId
     * @return
     */
    List<TurntableLotteryVO> turntableLottery(Long userId, Integer count,Integer type);


    void saveGift(List<LotteryLuckyUser> lotteryLuckyUsers, Long userId);



    List<Gift> getUserGiftList(Long userId);

    /**
     * 检查是否可以开启抽奖
     * @param userId
     * @return
     */
    Boolean checkIsOpenLottery(Long userId);

    void addGift(AddGiftDTO dto);

    List<GiftLotteryVO> getRewardList(Integer giftId, Boolean isProfit);

    /**
     * 开始钻洞
     * @param userId
     * @param count
     */
    void startWormhole(Long userId, Integer count);

    /**
     * 进入下一关虫洞
     * @param userId
     * @param count
     */
    WormholeLotteryVO nextWormhole(Long userId, Integer count);

    Boolean checkIsOpenWormhole(Long userId);

    /**
     * 结束虫洞游戏
     * @param wormholeId
     */
    List<Gift> endWormhole(Long wormholeId);
    /**
     * 更新礼物
     * @param dto
     */
    void updateGift(UpdateGiftDTO dto);

    List<Gift> getItemList(Integer giftId);

    /**
     * 设置用户下次必中礼物
     * @param dto
     */
    void giveLotteryGift(GiveLotteryGiftDTO dto);

    List<Gift> spendCoins(int coins,Integer type, Integer maxReward, Integer nextReward, Integer smallReward, Integer nextSmallReward, Integer smallestReward);

    Boolean checkIsOpenFoodStall(Long userId);

    Boolean checkIsOpenAdAstra(Long userId);

    Gift getByType(int type);
}
